<tagLib name="html" />
{$header}<div id="main" class="main" >
<!-- 主体内容  -->
<div class="content" >
<!--  功能组区域  -->
<div class="btn-toolbar">
      <div class="btn-group">
  <button class="btn btn-primary" onclick="add()"><i class="icon-plus icon-white"></i> 新增</button>
<button class="btn btn-primary" onclick="edit()"><i class="icon-edit icon-white"></i> 编辑</button>
<button class="btn btn-primary" onclick="foreverdel()"><i class="icon-trash icon-white"></i> 删除</button>
<button class="btn btn-primary" onclick="mass_add_goods()"><i class="icon-plus icon-white"></i> 批量添加唯一货品</button>
</div>
<!-- 查询区域 -->
<form class="search-form pull-right" method='post' action="__URL__">
		<input type="text" class="search-query span4" name="keywords" <notempty name='_REQUEST.keywords'>
		<php>echo 'value="'.urldecode($_REQUEST['keywords']).'"'</php>
		<else/>
		placeholder="搜索"
	</notempty>
	>
	<input type="submit" class="btn btn-primary" value="搜索"></form>
</div>
<!-- 功能组区域结束 -->
<?php 
	function countGoods($product_id){
		return M('Product')->where('common_id ='.$product_id)->count('id');
	}
 ?>
<!-- 列表显示区域  -->
<div class="list" >
<div id="result" class="result none"></div><html:list id="checkList" style="table table-bordered table-striped" name="action" checkbox="true" action="true" datasource="list" show="id:编号|5%:edit,name:品名:edit,brand_id|getModelName='Brand':品牌,id|countGoods:货品数,mano:编号" actionlist="edit:详情:id,addGoods:增加货品:id" />
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<!-- 主页面结束 --><include file="Public:footer"/>
<script type="text/javascript">
	function mass_add_goods(id){
    var keyValue = (id)? id : getSelectCheckboxValues();
	if (keyValue=='')
	{
		alert('请选择编辑项！');
		return false;
	}
        location.href = APP+"/Common_product/mass_add_unique_goods/cid/"+keyValue;
	}

	function addGoods(id){
		location.href = APP+"/Product/add/common_id/"+id;
	}

</script>


